﻿namespace FileCategorizer.Engine.Data
{
    /// <summary>
    /// This class is responsible for keeping one instance of the database
    /// in memory for the application.
    /// </summary>
    public static class DatabaseFactory
    {
        /// <summary>
        /// The active instance of the database.
        /// </summary>
        private static IDatabase db;

        /// <summary>
        /// Gets the active database instance.  If one does not exist,
        /// a new instance is created.
        /// </summary>
        public static IDatabase Instance
        {
            get
            {
                if (db == null)
                {
                    db = new MemoryDatabase();
                }

                return db;
            }
        }
    }
}
